<template>
{{#if ctrl.psSysPFPlugin}}
    {{> @macro/plugins/widget/widget-use.hbs appPlugin=ctrl.psSysPFPlugin}}
{{else}}
  <AppExpBar 
        :class="classNames">
{{#if ctrl.showTitleBar}}
    <template #titleBar>
      <div class="control-header__left__caption">
  {{#if ctrl.psSysImage}}
    {{#if ctrl.psSysImage.imagePath}}
        <img src="{{ctrl.psSysImage.imagePath}}"/>
    {{/if}}
    {{#if ctrl.psSysImage.cssClass}}
        <i class="{{ctrl.psSysImage.cssClass}}"></i>
    {{/if}}
  {{/if}}
        <span class="text">\{{model.lanResTag ? $t(model.lanResTag, model.title) : model.title}}</span>
      </div>
    </template>
{{/if}}
<template #quickGroup>
  <slot name="quickGroup"></slot>
</template>
{{#if ctrl.enableSearch}}
    <template #quickSearch>
      {{> @macro/common/quick-search.hbs placeholder="model.quickSearchPlaceHolder"}}
    </template>
{{/if}}
{{#ctrl.ctrls}}
  {{#eq controlType 'TOOLBAR'}}
    <template #toolbar>
      {{> @macro/widgets/toolbar/toolbar.hbs ctrl=ctrl}}
    </template>
  {{/eq}}
{{/ctrl.ctrls}}
    <template #default>
{{#ctrl.ctrls}}
  {{#eq controlType "CALENDAR"}}
      {{> @macro/widgets/calendar-detail/calendar.hbs ctrl=this props=":selectFirstDefault='true'
      :singleSelect='true'"}}
  {{/eq}}
{{/ctrl.ctrls}}
    </template>
    </AppExpBar>
{{/if}}
</template>
<script setup lang="ts">
// 基于template/src/widgets/\{{appEntities}}/\{{ctrls@CALENDAREXPBAR}}-calendar-exp-bar/\{{spinalCase ctrl.codeName}}-calendar-exp-bar.vue.hbs生成
{{> @macro/plugins/widget/widget-import.hbs ctrl=ctrl}}
{{#ctrl.ctrls}}
    {{#eq controlType "CALENDAR"}}
import {{codeName}}Calendar from '@widgets/{{spinalCase appEntity.codeName}}/{{spinalCase codeName}}-calendar/{{spinalCase codeName}}-calendar.vue';
    {{/eq}}
{{/ctrl.ctrls}}
{{#hasCtrl ctrl.ctrls 'TOOLBAR'}}
import { AppToolbar } from '@components/widgets/toolbar';
{{/hasCtrl}}
import { AppExpBar} from '@components/widgets/exp-bar';
import { CalendarExpBarActionType, CalendarExpBarController, IContext, ICalendarExpBarAbility, ICalendarExpBarControllerParams, ICalendarExpBarStore, IParam, ICalendarExpBarController, ILoadingHelper, createUUID, IViewCtx } from '@/core';
import { 
  useNavParamsBind, 
  useEventBind, 
  getExpBarClassNames, 
{{#hasCtrl ctrl.ctrls 'TOOLBAR'}}
  handleToolbarItemClick,
{{/hasCtrl}}
{{#if ctrl.enableSearch}}
  handleQuickSearch,
{{/if}}  
  handleCtrlInit, 
  handleCtrlAction, 
  handleCtrlDestroy 
} from '@/hooks/use-ctrl';
import { model } from './{{spinalCase ctrl.codeName}}-calendar-exp-bar-model';

// 输入参数
{{> @macro/widgets/ctrl/ctrl-props.hbs
    props="openView?: Function;
    newView?: Function;
    "
}}

// emit
{{> @macro/common/emit.hbs name="ctrl" actionType="CalendarExpBarActionType" ability="ICalendarExpBarAbility"}}    

const classNames = computed(() => {
    return getExpBarClassNames(model, props);
});

const controlID = 'id' + createUUID();    

const params: ICalendarExpBarControllerParams<CalendarExpBarActionType, ICalendarExpBarAbility> = {
    name: props.name,    
    model,
    evt,
    controlID,    
    pLoadingHelper: props.pLoadingHelper,      
    openView: props.openView,
    newView: props.newView,
    closeView: props.closeView,
    pViewCtx: props.pViewCtx,
    handler: (data: ICalendarExpBarStore) => { return reactive(data); }
};

// 控制器
{{> @macro/common/controller.hbs name="ctrl" IController="ICalendarExpBarController" store="ICalendarExpBarStore" ability="ICalendarExpBarAbility" controller="CalendarExpBarController"}}
</script>